import mysql.connector

#建立数据库连接
conn = mysql.connector.connect(user="root", password="123456", database="test")
#实例化数据库client
cursor = conn.cursor()

try:
	#执行sql语句
    cursor.execute("select * from live_source")
    values = cursor.fetchall()
    for i in values:
        print(i[0])
except Exception as e:
    print("err")
else:
    pass
finally:
	#关闭数据库连接
    cursor.close()
